*******
* UK

import excel "../data/main_VAR/UK_full.xlsx", sheet("Sheet1") firstrow clear


drop surplustogdp
gen surplustogdp = revtogdp - spendingtogdp
sum Year revtogdp spendingtogdp surplustogdp

gen revtogdppct=revtogdp*100
gen spendingtogdppct=spendingtogdp*100
gen surplustogdppct = surplustogdp*100

label var revtogdppct "UK Revenue/GDP"
label var spendingtogdppct "UK Spending/GDP"
label var surplustogdppct "UK Surplus/GDP"


preserve
keep if Year>=1729 & Year<=1946

eststo clear
eststo: estpost tabstat revtogdppct spendingtogdppct surplustogdppct, statistics(mean sd min p25 p50 p75 max) columns(statistics) 
esttab using "../results/tables_summarystats/sum_pre1946_uk.tex", cells("mean(fmt(1)) sd(fmt(1)) min(fmt(1)) p25(fmt(1))  p50(fmt(1)) p75(fmt(1)) max(fmt(1))") mtitles("Pre 1946") nonumber label replace
eststo clear

restore



preserve
keep if Year>=1947

eststo clear
eststo: estpost tabstat revtogdppct spendingtogdppct surplustogdppct, statistics(mean sd min p25 p50 p75 max) columns(statistics) 
esttab using "../results/tables_summarystats/sum_post1946_uk.tex", cells("mean(fmt(1)) sd(fmt(1)) min(fmt(1)) p25(fmt(1))  p50(fmt(1)) p75(fmt(1)) max(fmt(1))") mtitles("Post 1946") nonumber label replace
eststo clear

restore



preserve
keep if Year>=1729 & Year<=1946
drop if Year>1914

eststo clear
eststo: estpost tabstat revtogdppct spendingtogdppct surplustogdppct, statistics(mean sd min p25 p50 p75 max) columns(statistics) 
esttab using "../results/tables_summarystats/sum_preWWI_uk.tex", cells("mean(fmt(1)) sd(fmt(1)) min(fmt(1)) p25(fmt(1))  p50(fmt(1)) p75(fmt(1)) max(fmt(1))") mtitles("Pre 1914") nonumber label replace
eststo clear

restore



************
** US
import excel "../data/main_VAR/US_full.xlsx", sheet("Sheet1") firstrow clear

gen taupct = tau*100
gen gpct = g*100
gen surpluspct = s*100

label var taupct "US Revenue/GDP"
label var gpct "US Spending/GDP"
label var surpluspct "US Surplus/GDP"

preserve


keep if year>=1793 & year<=1946

eststo clear
eststo: estpost tabstat taupct gpct surpluspct, statistics(mean sd min p25 p50 p75 max) columns(statistics) 
esttab using "../results/tables_summarystats/sum_before1946_us.tex", cells("mean(fmt(1)) sd(fmt(1)) min(fmt(1)) p25(fmt(1))  p50(fmt(1)) p75(fmt(1)) max(fmt(1))") mtitles("Pre 1946") nonumber label replace
eststo clear

restore



preserve
keep if year>=1947 & year<=2020

eststo clear
eststo: estpost tabstat taupct gpct surpluspct, statistics(mean sd min p25 p50 p75 max) columns(statistics) 
esttab using "../results/tables_summarystats/sum_post1946_us.tex", cells("mean(fmt(1)) sd(fmt(1)) min(fmt(1)) p25(fmt(1))  p50(fmt(1)) p75(fmt(1)) max(fmt(1))") mtitles("Pre 1946") nonumber label replace
eststo clear

restore



preserve
keep if year>=1793 & year<=1946
drop if year>1914 

eststo clear
eststo: estpost tabstat taupct gpct surpluspct, statistics(mean sd min p25 p50 p75 max) columns(statistics) 
esttab using "../results/tables_summarystats/sum_pre1914_us.tex", cells("mean(fmt(1)) sd(fmt(1)) min(fmt(1)) p25(fmt(1))  p50(fmt(1)) p75(fmt(1)) max(fmt(1))") mtitles("Pre 1946") nonumber label replace
eststo clear
restore

*************Netherlands

import excel "../data/Netherlands/Holland_PF_v2.xlsx", sheet("Master_Data_Holland") firstrow clear



drop if _n==1

rename A Year


gen surplustogdp = tau- g
sum Year tau g surplustogdp

gen revtogdppct=tau*100
gen spendingtogdppct=g*100
gen surplustogdppct = surplustogdp*100

label var revtogdppct "$\tau$"
label var spendingtogdppct "$ g $"
label var surplustogdppct "$\tau-g$"



keep if Year>=1601 & Year <= 1794


eststo clear
eststo: estpost tabstat revtogdppct spendingtogdppct surplustogdppct, statistics(Mean SD Min p25 p50 p75 Max) columns(statistics) 
esttab using "../results/tables_summarystats/holland_pre1800.tex", cells("Mean(fmt(1)) SD(fmt(1)) Min(fmt(1)) p25(fmt(1))  p50(fmt(1)) p75(fmt(1)) Max(fmt(1))") mtitles("1601-1794") nonumber label replace
eststo clear

import excel "../data/Netherlands/NetherlandsPF_1815_1938.xlsx", sheet("Master_Data_Netherlands") firstrow clear



drop if _n==1

rename year Year


gen surplustogdp = tau- g
sum Year tau g surplustogdp

gen revtogdppct=tau*100
gen spendingtogdppct=g*100
gen surplustogdppct = surplustogdp*100

label var revtogdppct "$\tau$"
label var spendingtogdppct "$ g $"
label var surplustogdppct "$\tau-g$"


keep if Year>=1817 & Year <= 1914

sum revtogdppct spendingtogdppct surplustogdppct
eststo clear
eststo: estpost tabstat revtogdppct spendingtogdppct surplustogdppct, statistics(Mean SD Min p25 p50 p75 Max) columns(statistics) 
esttab using "../results/tables_summarystats/holland_1817-1914.tex", cells("Mean(fmt(1)) SD(fmt(1)) Min(fmt(1)) p25(fmt(1))  p50(fmt(1)) p75(fmt(1)) Max(fmt(1))") mtitles("1817-1914") nonumber label replace
eststo clear





